<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<isperp:changeView>

	<jsp:body> 
<div class="header">
	<h3>变更信息</h3>
</div>
<table class="form-table">
	<jsp:include page="step1view.jsp"></jsp:include>
</table>

<form class="validate" id="changeForm" action="change/change/save"
			method="post">
	<input name="id" type="hidden" value="${model.id }">


	<div class="header">
		<h3>测试</h3>
	</div>

	<table class="form-table">
		<tr>
			<td class="td1">测试结论：</td>
			<td class="td2"><textarea id="publishDescription" name="publishDescription">${model.publishDescription }</textarea>
			</td>
		</tr>
		
	</table>
</form>

</jsp:body>
</isperp:changeView>

<isperp:buttonList>
	<isperp:processButtons processKey="changeProcess" formId="changeForm"
		processId="${model.processId }" businessKey="${model.id }"></isperp:processButtons>
</isperp:buttonList>


<script type="text/javascript">
	var $accountingEntryDialog = $("#accountingEntryDialog").dialog({
		modal : true,
		autoOpen : false,
		width : 500,
		height : 450,
		open : function(event, ui) {
			$("#createCusUserId").val("");

		},
		buttons : {
			保存 : function() {
				var $me = $(this);
				isperp.getWindow("accountingEntryIframe").sumbitForm(function(id) {
					$me.dialog("close");
					accountingEntryGrid.reload();
				});

			}

		}
	});
	function accountingEntryGridEdit(rowid) {

		var url = "project/costAccountingEntry/edit?projectId=${model.projectId}&relationId=${model.id}";
		if (rowid)
			url = url + "&id=" + rowid;

		$("#accountingEntryIframe").attr("src", url);

		$accountingEntryDialog.dialog("open");
	}

	function formatSelector(rowObject, gridId) {
		return "<a class=\"nui-txt-link\" onclick=\"" + gridId + ".jqGrid.setSelection('" + rowObject.id + "');" + gridId + "Selected();\">选择</a>";
	}

	function formatCiName(rowObject) {
		return "<a href=\"javascript:isperp.openDialog({contentUrl:'configuration/ci/ciResumeView?id=" + rowObject.id + "'});\">" + rowObject.name + "</a>";
	}

	var assAssectGridSelected = function(id, name) {
		if (!id && !name) {
			var selectedRow = assAssectGrid.getRowData();
			id = selectedRow.id;
			name = selectedRow.name;
		}
		if (id && name) {
			var msg = {
				id : id,
				name : name
			};
			var rs = formatCiName(msg);
			$("#assAssetId").val(id);
			$("#ci_idMsg").html(rs);
		}
	};

	function customerCi_Onclick() {
		isperp.openDialog({
			onThisWindow : true,
			title : "选择关联资产",
			windowSize : "normal",
			contentUrl : "customer/customer/customerCiEdit?customerId=",
			buttons : [ {
				text : "确定",
				"class" : "nui-mainbtn",
				click : function() {
					var $me = $(this);
					$me.find("iframe")[0].contentWindow.getSelectRow(function(id, name) {
						assAssectGridSelected(id, name);
						$me.wijdialog("close");
					});
				}
			}, {
				text : "关闭",
				"class" : 'grey',
				click : function() {
					$(this).wijdialog("close");
				}
			} ]
		});

	}
</script>



<c:choose>
	<c:when test="${empty model.ciId }">

	</c:when>
	<c:otherwise>
		<script type="text/javascript">
			assAssectGridSelected("${model.ciId}", "${model.ciName}");
		</script>
	</c:otherwise>
</c:choose>